<template>
  <div class="item-main">
    <div class="item-proce f-l" :style="{width: width}" v-for="(item,index) in proces" :key="index">
      <div class="f-l">
        <div class="fontTitle">{{item.text}}</div>
        <!--未评价状态之前通用样式  -->
          <div v-if="index != 4">
            <div :class="[item.procesed ? 'bg-c1' : 'bg-c2','order-img']"></div>
          </div>

          <!--评价状态通用样式  -->
          <div v-else>
            <div :class="[item.procesed ? 'bg-c3' : 'bg-c4','order-img']"></div>
          </div>

        <div class="fontTime">{{item.time}}</div>
      </div>
      <div class="f-l right" v-show="index==proces.length-1?false:true">
        <!-- <div class="line"></div> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    proces: {
      type: Array,
      default() {
        return [
          {
            text: '拍下商品',
            time: '',
            procesed: true
          },
          {
            text: '已付款',
            time: '',
            procesed: false
          },
          {
            text: '已发货',
            time: '',
            procesed: false
          },
          {
            text: '确认收货',
            time: '',
            procesed: false
          },
          {
            text: '评价',
            time: '',
            procesed: false
          }
        ]
      }
    }
  },
  computed: {
    width() {
      return `${100 / this.proces.length}%`
    }
  },
  created() {
    // this.oOrderGood = this.oOrderGood
    const orderStatus = this.oOrderGood.orderStatus // 取订单状态
    this.getOrderInfo(orderStatus)
  },
  methods: {
    // 获取订单的状态，时间
    getOrderInfo(orderStatus) {
      if (orderStatus == '0') {
        this.proces[0].time = this.oOrderGood.addtime
      }
      console.log(22222222, this.oOrderGood)
      console.log(333333, this.proces[0].time)
    }
  }
}
</script>

<style lang="scss">
  @import '../scss/_var.scss';
  .item-main{
    width: 100%;
    .item-proce{
      text-align: center;
      background-color: $color-white;
    }
  }
  .order-img {
    width: 180px;
    height: 41px;
    margin: 8px 0 20px;
  }
  .bg-c1{
    background-image: url('../assets/order.png');
    background-repeat: no-repeat;
  }
  .bg-c2{
    background-image: url('../assets/icon-greyEval.png');
    background-repeat: no-repeat;
  }
  // 未评价图片
  .bg-c3{
    background-image: url('../assets/icon_lightprocess.png');
    background-repeat: no-repeat;
  }
  // 已评价
  .bg-c4{
    background-image: url('../assets/icon-eval.png');
    background-repeat: no-repeat;
  }
  .f-l{
    float: left;
    .fontTitle {
      font-size: 14px;
      color: $color-dark;
    }
    .fontTime {
      font-size: 12px;
      color: $color-gray;
    }
  }
</style>